from selenium.webdriver.common.by import By

from Web_PO.PO_ceshiren.ceshiren.BaseDriver import BaseDriver


class SeachPackage(BaseDriver):
    def seach_package(self,content):
        # ele = self.find_and_click(By.XPATH,"//*[@class = 'full-page-search search no-blur search-query ember-text-field ember-view']")
        # ele = self.driver.find_element(By.XPATH,"//*[@class = 'full-page-search search no-blur search-query ember-text-field ember-view']")
        # ele.send_keys(content)
        self.find_and_input(By.CSS_SELECTOR,".search-bar .full-page-search",content)

        self.find_and_click(By.CSS_SELECTOR, '.btn-primary.search-cta.btn.btn-icon-text')
        # self.driver.find_element(By.CSS_SELECTOR, '.btn-primary.search-cta.btn.btn-icon-text').click()
        # 搜索页面，也就是SeachPackage
        return self
    def get_result(self):
        res = self.find_and_text(By.CLASS_NAME, "topic-title")
        # res = self.driver.find_element(By.CLASS_NAME, "topic-title").text
        return res
    def get_result_fail(self):
        res = self.find_and_text(By.CLASS_NAME, "fps-invalid")
        return res
